package com.minimalist.common.entity.basic.vo.file;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import org.springframework.web.multipart.MultipartFile;

import java.io.Serial;
import java.io.Serializable;

/**
 * @author 11987
 */
@Schema(name = "文件上传实体")
public class FileUploadVO implements Serializable{

    @Serial
    private static final long serialVersionUID = 1L;

    @NotNull(message = "上传的文件不能为空")
    @Schema(name = "file", description = "文件(单个文件)", type = "file")
    private MultipartFile file;

    @Schema(name = "fileSource", description = "文件来源，字典：file-source-path", type = "string")
    private Integer fileSource = -1;

    @Schema(name = "storageId", description = "存储ID，可为空。为空则取默认使用的存储", type = "string")
    private Long storageId;

    @Schema(name = "createId", description = "创建人ID", type = "string")
    private Long createId;

    @Schema(name = "updateId", description = "更新人ID", type = "string")
    private Long updateId;

    @Schema(name = "tanantId", description = "租户ID", type = "string")
    private Long tanantId;

    public MultipartFile getFile() {
        return file;
    }

    public void setFile(MultipartFile file) {
        this.file = file;
    }

    public Integer getFileSource() {
        return fileSource;
    }

    public void setFileSource(Integer fileSource) {
        this.fileSource = fileSource;
    }

    public Long getStorageId() {
        return storageId;
    }

    public void setStorageId(Long storageId) {
        this.storageId = storageId;
    }

    public Long getCreateId() {
        return createId;
    }

    public void setCreateId(Long createId) {
        this.createId = createId;
    }

    public Long getUpdateId() {
        return updateId;
    }

    public void setUpdateId(Long updateId) {
        this.updateId = updateId;
    }

    public Long getTanantId() {
        return tanantId;
    }

    public void setTanantId(Long tanantId) {
        this.tanantId = tanantId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        FileUploadVO that = (FileUploadVO) o;
        return java.util.Objects.equals(file, that.file) &&
               java.util.Objects.equals(fileSource, that.fileSource) &&
               java.util.Objects.equals(storageId, that.storageId) &&
               java.util.Objects.equals(createId, that.createId) &&
               java.util.Objects.equals(updateId, that.updateId) &&
               java.util.Objects.equals(tanantId, that.tanantId);
    }

    @Override
    public int hashCode() {
        return java.util.Objects.hash(file, fileSource, storageId, createId, updateId, tanantId);
    }

    @Override
    public String toString() {
        return "FileUploadVO{" +
               "file=" + file +
               ", fileSource=" + fileSource +
               ", storageId=" + storageId +
               ", createId=" + createId +
               ", updateId=" + updateId +
               ", tanantId=" + tanantId +
               '}';
    }

}
